import request from '@/utils/request'
/**
 *
 * @param {id,count} param0 添加购物车的商品id和数量
 * @returns Promise
 */
export const insertGoodsToCart = ({ id, count }) => {
    return request('/cart', 'post', {
        goods_id: id,
        number: count,
        uid: JSON.parse(localStorage.useManage).profile.id,
    })
}
/**
 * 查找当前用户的购物车
 * @returns
 */
export const findUserCart = () => {
    return request('/cart/find', 'get', {
        id: JSON.parse(localStorage.useManage).profile.id,
    })
}
/**
 *  修改商品数量
 * @param {int} goods_id 修改商品的id
 * @param {int} number 修改后的数量
 * @returns
 */
export const modifyGoodsNumber = (goods_id, number) => {
    return request('/cart/modify', 'get', {
        goods_id,
        number,
    })
}
/**
 * 删除购物车某个商品
 * @param {int} goods_id 要删除商品的id
 * @returns Promise
 */
export const delCartGoodsById = goods_id => {
    return request('/cart/del', 'get', { goods_id })
}
